<?php
/*------------------------------------------------------------------------
# mod_PGMap - Google Map Module
# ------------------------------------------------------------------------
# author PixelTOP
# copyright Copyright (C) 2010 dev.pixeltop.com.br. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.dev.pixeltop.com.br
# Technical Support: dev.pixeltop.com.br/contact
-------------------------------------------------------------------------*/
// no direct access

defined( '_JEXEC' ) or die( 'Restricted access' ); 

jimport('joomla.html.parameter.element');
class GElement extends JElement{
	
	static function getParameters($mod = 'mod_GMap'){
		static $params;
		$file = JPATH_SITE . 'modules/' .DS . $mod . DS . $mod . '.xml';	
		if(!is_object($params) ){

			$app = JFactory::getApplication();
//			$id = $app->getUserState('com_modules.edit.module.id');
			$id = JRequest::getInt('id');
			if($id){	
				$db = JFactory::getDBO();
				$sql = 'select * from #__modules where ';
				$sql .= 'id = ' . $id;
				$db->setQuery($sql);
				$module = $db->loadObject();
				$params = new JParameter($module->params, $file);
			}else{
				$params = new JParameter(null, $file);
			}
			
		}
		
		return $params;
	}
}